package application;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TabPane;
import javafx.scene.layout.AnchorPane;
import javafx.scene.web.WebView;
import javafx.stage.Stage;



public class Model {
	
	private static Model self;
	private Stage stage;
	private TabPane TP;
	private AnchorPane APRead;
	private WebView wVRead;
	private Button btnMaxR;
	private Button btnMaxW;
	private Scene scene;
		
	public Scene getScene() {
		return scene;
	}

	public void setScene(Scene scene) {
		this.scene = scene;
	}

	public Button getBtnMaxR() {
		return btnMaxR;
	}

	public void setBtnMaxR(Button btnMaxR) {
		this.btnMaxR = btnMaxR;
	}

	public Button getBtnMaxW() {
		return btnMaxW;
	}

	public void setBtnMaxW(Button btnMaxW) {
		this.btnMaxW = btnMaxW;
	}

	public TabPane getTP() {
		return TP;
	}

	public void setTP(TabPane tP) {
		TP = tP;
	}

	public AnchorPane getWPRead() {
		return APRead;
	}

	public void setWPRead(AnchorPane wPRead) {
		APRead = wPRead;
	}

	public WebView getwVRead() {
		return wVRead;
	}

	public void setwVRead(WebView wVRead) {
		this.wVRead = wVRead;
	}

	public Stage getStage() {
		return stage;
	}

	public void setStage(Stage stage) {
		this.stage = stage;
	}

	public static Model getReference() {
		if (self == null) {
			self = new Model();
		}

		return self;
	}
	
	private Model(){

	}

	public void maximize() {
//		scene.widthProperty().addListener(new ChangeListener<Number>() {
//		    @Override public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneWidth, Number newSceneWidth) {
//		    	String oldString = String.valueOf(oldSceneWidth);
//		    	oldString = oldString.substring(0,oldString.indexOf("."));
//		    	System.out.println("OLDSTRING::  "+oldString);
//		    	oldString = String.valueOf(oldSceneWidth).substring(0,String.valueOf(oldSceneWidth).length()-2);
//		    	String newString = String.valueOf(newSceneWidth).substring(0,String.valueOf(oldSceneWidth).length()-2);
//		    	int oldInt = Integer.valueOf(oldString);
//		    	int newInt = Integer.valueOf(newString);
//		    	System.out.println("oldWidth: "+oldInt+" newWidth: "+newInt);
//		       if (oldInt < newInt) {
//		    	   btnMaxR.setText("Min");
//					btnMaxW.setText("Min");
//		       }	else {
//		    	   btnMaxR.setText("Max");
//		    	   btnMaxW.setText("Max");
//		       }
//		    }
//		});
		if (!stage.isFullScreen()) {
			stage.setFullScreen(true);
		}	else {
			stage.setFullScreen(false);
		}
	}
	
}
		
